{ INFORMATICS.MCCME.RU
  Problem statement: http://informatics.mccme.ru/moodle/mod/statements/view3.php?chapterid=1370
  Verdict: Accepted
}
var a,b,i,n,k:longint;
begin
reset(input,'input.txt');
rewrite(output,'output.txt');
read(n,a,b);
for i:=n-1 downto 1 do begin
  k:=b-a;
  b:=a;
  a:=k;
end;
write(a,' ',b);
end.